{include file='public/header' /}
<div class="layuimini-container">
    <form id="modelUserForm" lay-filter="modelUserForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label for="" class="layui-form-label">分类</label>
            <div class="layui-input-block">
                <select name="auth" search>
                    <option value="0">请选择</option>
                    {volist name='auth' id='vo'}
                    <option value="{$vo.id}" {eq name="$vo.id" value="$row.admin.auth_ids"} selected {/eq}>{$vo.title}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">项目名称</label>
            <div class="layui-input-block">
                <input name="name"  value="{$row.name}" placeholder="请输入项目名称" type="text" class="layui-input" maxlength="20"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">超级管理员账号</label>
            <div class="layui-input-block">
                <input name="username" value="{$row.admin.username}" disabled placeholder="请输入超级管理员账号" type="text" class="layui-input" maxlength="20"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">超级管理员密码</label>
            <div class="layui-input-block">
                <input name="" value="{$row.admin.password}" disabled placeholder="请输入超级管理员密码" type="password" class="layui-input" maxlength="20"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <input type="hidden" name="id" value="{$row.id}">
            <button class="layui-btn layui-btn-primary" type="button" onclick="close_window()" ew-event="closePageDialog">取消</button>
            <button class="layui-btn" lay-filter="modelSubmitUser" lay-submit>保存</button>
        </div>
    </form>
</div>
{include file='public/footer' /}
<script>
    layui.use(['layer', 'form', 'table', 'util', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;


        var url = '{:__url("app.apps/edit")}';

        // 表单提交事件
        form.on('submit(modelSubmitUser)', function (data) {
            layer.load(2);
            $.post(url, data.field, function (res) {

                layer.closeAll('loading');
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1,time: 1000},function(index){
                        window.parent.location.reload();
                    });
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'json');
            return false;
        });
    });
    function close_window(){
        window.parent.location.reload();
    }
</script>